<!--
  ~ Licensed to the Apache Software Foundation (ASF) under one
  ~ or more contributor license agreements.  See the NOTICE file
  ~ distributed with this work for additional information
  ~ regarding copyright ownership.  The ASF licenses this file
  ~ to you under the Apache License, Version 2.0 (the
  ~ "License"); you may not use this file except in compliance
  ~ with the License.  You may obtain a copy of the License at
  ~
  ~   http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing,
  ~ software distributed under the License is distributed on an
  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  ~ KIND, either express or implied.  See the License for the
  ~ specific language governing permissions and limitations
  ~ under the License.
-->

<nz-spin [nzSpinning]="loading">
  <div class="main" *ngIf="config">
    <div class="left">
      <form nz-form nzLayout="vertical" #f="ngForm" (submit)="onSaveSystemConfig()" se-container="1">
        <se [label]="'settings.system-config.locale' | i18n" [error]="'validation.required' | i18n">
          <div style="width: 400px">
            <nz-select
              [(ngModel)]="config.locale"
              [ngModelOptions]="{ standalone: true }"
              style="text-align: center; font-weight: bolder"
              [nzDropdownStyle]="{ 'font-weight': 'bolder', 'font-size': 'larger' }"
            >
              <nz-option [nzValue]="'en_US'" [nzLabel]="'settings.system-config.locale.en_US' | i18n"></nz-option>
              <nz-option [nzValue]="'zh_CN'" [nzLabel]="'settings.system-config.locale.zh_CN' | i18n"></nz-option>
              <nz-option [nzValue]="'zh_TW'" [nzLabel]="'settings.system-config.locale.zh_TW' | i18n"></nz-option>
              <nz-option [nzValue]="'ja_JP'" [nzLabel]="'settings.system-config.locale.ja-JP' | i18n"></nz-option>
              <nz-option [nzValue]="'pt_BR'" [nzLabel]="'settings.system-config.locale.pt_BR' | i18n"></nz-option>
            </nz-select>
          </div>
        </se>
        <se [label]="'settings.system-config.timezone' | i18n" [error]="'validation.required' | i18n">
          <div style="width: 400px">
            <nz-select
              [(ngModel)]="config.timeZoneId"
              [ngModelOptions]="{ standalone: true }"
              [nzDropdownMatchSelectWidth]="false"
              style="text-align: center; font-weight: bolder"
              [nzDropdownStyle]="{ 'font-weight': 'bolder', 'font-size': 'larger' }"
              nzShowSearch
            >
              <nz-option
                *ngFor="let tz of timezones"
                [nzValue]="tz.zoneId"
                [nzLabel]="tz.zoneId + ' (' + tz.offset + ') ' + tz.displayName"
              ></nz-option>
            </nz-select>
          </div>
        </se>
        <se [label]="'settings.system-config.theme' | i18n" [error]="'validation.required' | i18n">
          <div style="width: 400px">
            <nz-select
              [(ngModel)]="config.theme"
              [ngModelOptions]="{ standalone: true }"
              style="text-align: center; font-weight: bolder"
              [nzDropdownStyle]="{ 'font-weight': 'bolder', 'font-size': 'larger' }"
            >
              <nz-option [nzValue]="'default'" [nzLabel]="'settings.system-config.theme.default' | i18n"></nz-option>
              <nz-option [nzValue]="'dark'" [nzLabel]="'settings.system-config.theme.dark' | i18n"></nz-option>
              <nz-option [nzValue]="'compact'" [nzLabel]="'settings.system-config.theme.compact' | i18n"></nz-option>
            </nz-select>
          </div>
        </se>
        <se>
          <button nz-button nzType="primary" [disabled]="f.invalid">{{ 'settings.system-config.ok' | i18n }}</button>
        </se>
      </form>
    </div>
  </div>
</nz-spin>
